//
//  LXMoreAuthorCell.m
//  喜马拉雅改良版框架
//
//  Created by liuxin on 15/12/28.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "LXMoreAuthorCell.h"

@implementation LXMoreAuthorCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews{
    self.userImage = [[UIImageView alloc]init];
    [self.contentView addSubview:self.userImage];
    [self.userImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.top.mas_equalTo(10);
        make.height.mas_equalTo(60);
        make.width.mas_equalTo(60);
    }];
    
    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.font = [UIFont systemFontOfSize:17];
    [self.contentView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(10);
        make.left.equalTo(self.userImage.mas_right).offset(10);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(20);
    }];
    
    self.categartLabel = [[UILabel alloc]init];
    self.categartLabel.font = [UIFont systemFontOfSize:13];
    self.categartLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.categartLabel];
    [self.categartLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(5);
        make.left.equalTo(self.titleLabel);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(15);
    }];
    
    UIImageView *trackImage = [[UIImageView alloc]init];
    trackImage.image = [UIImage imageNamed:@"find_hotUser_sounds@2x.png"];
    [self.contentView addSubview:trackImage];
    [trackImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.categartLabel);
        make.top.equalTo(self.categartLabel.mas_bottom).offset(5);
        make.height.mas_equalTo(15);
        make.width.mas_equalTo(15);
    }];
    
    self.trackLabel = [[UILabel alloc]init];
    self.trackLabel.font = [UIFont systemFontOfSize:13];
    self.trackLabel.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.trackLabel];
    [self.trackLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(trackImage);
        make.left.equalTo(trackImage.mas_right).offset(5);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(15);
    }];
    
    UIImageView *followImage = [[UIImageView alloc]init];
    followImage.image = [UIImage imageNamed:@"find_hotUser_fans@2x.png"];
    [self.contentView addSubview:followImage];
    [followImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.trackLabel);
        make.left.equalTo(self.trackLabel.mas_right).offset(10);
        make.width.mas_equalTo(15);
        make.height.mas_equalTo(15);
    }];
    
    self.followLable = [[UILabel alloc]init];
    self.followLable.font = [UIFont systemFontOfSize:13];
    self.followLable.textColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.followLable];
    [self.followLable mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(followImage.mas_right).offset(5);
        make.top.equalTo(followImage);
        make.right.mas_equalTo(-10);
        make.height.mas_equalTo(15);
    }];
}
-(void)setCellModel:(LXMoreAuthorModel *)cellModel{
    [self.userImage sd_setImageWithURL:[NSURL URLWithString:cellModel.largeLogo] placeholderImage:[UIImage imageNamed:ImagePlaceHolder]];
    self.titleLabel.text = cellModel.nickname;
    self.categartLabel.text  =cellModel.personDescribe;
    self.trackLabel.text = [NSString stringWithFormat:@"%ld",cellModel.tracksCounts];
    if (cellModel.followersCounts<10000) {
        self.followLable.text = [NSString stringWithFormat:@"%ld",cellModel.followersCounts];
    }else{
    self.followLable.text = [NSString stringWithFormat:@"%.1f万",cellModel.followersCounts/10000.0];
    }
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
